Skip to main content

Listing Eizen Resources via SDK

Purpose

This document outlines the standard methods for retrieving lists of core resources (Tenants, Analytics Types, Analytics Categories, Zones, Users) from the Eizen/Vantara platform using the Eizen Python SDK (eizen_sdk).

The examples focus on the expected structure of the returned data, without revealing specific data values.


Prerequisites

1.Eizen SDK Installed:
Ensure the eizen_sdk library is installed in your Python environment.

pip install eizen_sdk

2. **Valid Refresh Token:** You need a valid refresh token with the necessary permissions to view the respective resources (e.g., view-tenant-list, view-analytics-type-list, view-user-list, etc.).
3. **SDK Instantiation:** The EizenSDK must be initialized with your refresh token.
## **Common Setup**
All examples below assume the SDK has been initialized successfully as shown here.

\# Import the SDK class
# Import the SDK class from eizen_sdk
from eizen_sdk import EizenSDK

# --- Configuration ---
# !! IMPORTANT: Replace with your actual refresh token obtained securely !!
# Avoid hardcoding tokens directly in scripts for production environments.
# Consider using environment variables, secrets management, or config files.


# --- SDK Initialization ---
# Import the SDK class from eizen_sdk
from eizen_sdk import EizenSDK

REFRESH_TOKEN = "PASTE_YOUR_VALID_REFRESH_TOKEN_HERE"

sdk = None
try:
sdk = EizenSDK(refresh_token=REFRESH_TOKEN)
print("SDK Initialized Successfully.")
except Exception as e:
print(f"FATAL: Error initializing Eizen SDK: {e}")
exit(1)


# --- Now you can use the 'sdk' object for subsequent calls ---



-----
## **1. Listing All Tenants**
Retrieves a list of all tenants accessible with the provided token's permissions.
### **Function**

sdk.get_all_tenants()


### **Example Usage**
if sdk: # Ensure SDK was initialized
try:
tenants_list = sdk.list_tenants()

if tenants_list is None:
print("No tenants found or received empty response.")
elif isinstance(tenants_list, list):
if not tenants_list:
print("Tenant list is empty.")
else:
print("Tenants List:")
for idx, tenant in enumerate(tenants_list, start=1):
print(f"{idx}. {tenant}")
else:
print(f"Unexpected data type: {type(tenants_list)}")
except Exception as e:
print(f"Error occurred while fetching tenants: {e}")



# Further error diagnosis might involve checking logs or API response details if available

-----
## **2. Listing All Analytics Types**
Retrieves a list of all analytics types, often scoped by tenant or accessible globally depending on configuration and permissions.
### **Function**
sdk.get_all_analytics_types()

### **Example Usage**
if sdk:
try:
analytics_types_list = sdk.list_analytics_types()

if analytics_types_list is None:
print("No analytics types found or received empty response.")
elif isinstance(analytics_types_list, list):
if not analytics_types_list:
print("Analytics types list is empty.")
else:
print("Analytics Types List:")
for idx, analytics_type in enumerate(analytics_types_list, start=1):
print(f"{idx}. {analytics_type}")
else:
print(f"Received unexpected data type for analytics types: {type(analytics_types_list)}")
except Exception as e:
print(f"Error occurred while fetching analytics types: {e}")



-----
## **3. Listing All Analytics Categories**
Retrieves a list of all analytics categories, usually associated with specific analytics types and tenants.
### **Function**
sdk.get_all_analytics_categories()

### **Example Usage**
if sdk:
try:
analytics_categories_list = sdk.list_analytics_categories()

if analytics_categories_list is None:
print("No analytics categories found or received empty response.")
elif isinstance(analytics_categories_list, list):
if not analytics_categories_list:
print("Analytics categories list is empty.")
else:
print("Analytics Categories List:")
for idx, analytics_category in enumerate(analytics_categories_list, start=1):
print(f"{idx}. {analytics_category}")
else:
print(f"Received unexpected data type for analytics categories: {type(analytics_categories_list)}")
except Exception as e:
print(f"Error occurred while fetching analytics categories: {e}")

-----
## **4. Listing All Zones**
Retrieves a list of all defined zones, typically associated with specific analytics instances.
### **Function**
sdk.get_all_zones()

### **Example Usage**
if sdk:
try:
sources_list = sdk.list_sources()

if sources_list is None:
print("No sources found or received empty response.")
elif isinstance(sources_list, list):
if not sources_list:
print("Sources list is empty.")
else:
print("Sources List:")
for idx, source in enumerate(sources_list, start=1):
print(f"{idx}. {source}")
else:
print(f"Received unexpected data type for sources: {type(sources_list)}")
except Exception as e:
print(f"Error occurred while fetching sources: {e}")


-----
## **5. Listing All Users**
Retrieves a list of user accounts. Depending on the token's permissions and system configuration, this might list users across all tenants or only those within specific tenants associated with the token/user.
### **Function**
sdk.get_all_users()

### **Example Usage**
if sdk:
try:
users_list = sdk.list_users()

if users_list is None:
print("No users found or received empty response.")
elif isinstance(users_list, list):
if not users_list:
print("Users list is empty.")
else:
print("Users List:")
for idx, user in enumerate(users_list, start=1):
print(f"{idx}. {user}")
else:
print(f"Received unexpected data type for users: {type(users_list)}")
except Exception as e:
print(f"Error occurred while fetching users: {e}")


-----